php try catch non object

42

// try..catch works on thrown exceptions. Errors are not exceptions. 
// You can silence errors, but please don't do that. 
// Instead, properly check what you're getting:

$result = Model()->find('id=1');
if ($result) {
    $id = $result->id;
} else {
    // handle this situation
}

Comments

Submit
0 Comments